<?php
$this->headMeta()->appendHttpEquiv('Content-Type', 'text/html;charset=utf-8');
$this->headTitle()->setSeparator(' - ');
$this->headTitle('Smart Venue Manager');
$this->headTitle($this->title);
echo $this->doctype('XHTML1_TRANSITIONAL') . "\n";
?>

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
        <link rel="stylesheet" href="<?=$this->baseUrl()?>/css/backend.layout.css" />
        <script type="text/javascript" src="<?=$this->baseUrl()?>/js/jquery-1.6.1.min.js"></script>

        <?php echo $this->headMeta(); ?>
        <?php echo $this->headTitle(); ?>
    </head>
    <body>
    <div id="wrapper">
        <div id="header">
            <div id="top">
                <img src="<?=$this->baseUrl()?>/images/logo-backend.png" alt="Logo Backend"/>
                <div id="admin">
                    Welcome,
                    <?php if(isset($this->session)): ?>
                        <?=$this->session['full_name']?>! <br />
                        <a href="#">My Profile</a> | <a href="<?=$this->baseUrl()?>/backend/index/logout">Logout</a>
                    <?php else: ?>
                        Guest!
                    <?php endif; ?>
                </div>
            </div>
            <div id="nav">
                <div style="padding: 0px 15px;">Menu:</div>
                <?php //Get role id in order to set available menu for logged-in admin
                    if(isset($_SESSION['admin']))
                        $loginRole = $_SESSION['admin']['role_id'];
                    else
                        $loginRole = 0;
                ?>
                <div><a href="<?=$this->baseUrl()?>/backend">Home</a></div>
                <?php if($loginRole!=0): ?>
                    <?php if($loginRole<3): ?><div class="link" id="admin-menu"><a href="<?=$this->baseUrl()?>/backend/admin">Admin</a></div><?php endif; ?>
                    <?php if($loginRole<3): ?><div class="link" id="sales-menu"><a href="<?=$this->baseUrl()?>/backend/sales">Sales</a></div><?php endif; ?>
                    <?php if($loginRole==3): ?><div class="link" id="user-menu"><a href="<?=$this->baseUrl()?>/backend/user">Customer</a></div><?php endif; ?>
                    <?php if($loginRole==3): ?><div class="link" id="booking-menu"><a href="<?=$this->baseUrl()?>/backend/booking">Booking</a></div><?php endif; ?>
                    <?php if($loginRole<3): ?><div class="link" id="venue-menu"><a href="<?=$this->baseUrl()?>/backend/venue">Floor/Venue</a></div><?php endif; ?>
                <?php endif; ?>
            </div>
        </div>
        <div id="content">
            <?php
                if(isset ($this->adminctrl)) include 'admin-layout.php';
                else if(isset ($this->userctrl)) include 'user-layout.php';
                else if(isset ($this->salesctrl)) include 'sales-layout.php';
                else if(isset ($this->bookingctrl)) include 'booking-layout.php';
                else if(isset ($this->venuectrl)) include 'venue-layout.php';
                else echo $this->layout()->content;
            ?>
        </div>
        <div id="footer">
            <b>Copyright</b> PT. Bit Zero Informatika <?=date("Y")?>
        </div>
    </div>
    </body>
</html>